In [13]:
%matplotlib inline

from compare_bmp import compare_images
from PIL import Image, ImageFilter
from matplotlib.pyplot import imshow

We'll start with this image: img1


In [18]:
imgpath = 'images/original/image.bmp'
blurredpath = 'images/image_blurred.bmp'

img = Image.open(imgpath)
blurred = img.copy().filter(ImageFilter.BLUR)

blurred.save(blurredpath)

And here it is now that we've blurred it: img_blurred

Now, let's compare the two to see what kind of error rates we can expect:


In [19]:
[red_flipped, green_flipped, blue_flipped] = compare_images(imgpath, blurredpath)


(500, 500, 3)
Count of total number of bits flipped in each position for R, G, B
[[8680, 18725, 38300, 62671, 85160, 99502, 112242, 121606], [8517, 17756, 37740, 63315, 84678, 98713, 110854, 121037], [3433, 16933, 38396, 64114, 85847, 99906, 112236, 121968]]
Percentage of red bits flipped in each position
[3.472, 7.489999999999999, 15.32, 25.0684, 34.064, 39.800799999999995, 44.8968, 48.6424]
Percentage of green bits flipped in each position
[3.4068, 7.1024, 15.096000000000002, 25.325999999999997, 33.8712, 39.4852, 44.3416, 48.4148]
Percentage of blue bits flipped in each position
[1.3732, 6.7732, 15.3584, 25.6456, 34.338800000000006, 39.962399999999995, 44.894400000000005, 48.7872]

It looks like we can expect (in this scenario) a worst-case of about 50% of the image's least significant bits to be flipped.